# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=emacs-liberime
pkgver=0.0.6_git20230113
_gitrev=cc9eb9812fd6f68e78ed6a0c0a85da7a18765753
pkgrel=0
_pkgreal=liberime
pkgdesc="Emacs librime bindings"
url="https://github.com/merrickluo/liberime"
arch="all"
license="GPL-3.0-or-later"
depends="cmd:emacs"
makedepends="emacs-nox librime-dev"
checkdepends="emacs-pyim rime-plum-data"
source="https://github.com/merrickluo/liberime/archive/$_gitrev/emacs-liberime-$_gitrev.tar.gz"
builddir="$srcdir/$_pkgreal-$_gitrev"
options="!check" # opens an interactive Emacs window

build() {
	make

	emacs -batch -q -no-site-file -L . \
		-f batch-byte-compile \
		liberime.el
}

check() {
	mkdir -p "$srcdir"/.emacs.d/test/rime
	make HOME="$srcdir" test
}

package() {
	install -Dvm644 liberime.el* src/liberime-core.so \
		-t "$pkgdir"/usr/share/emacs/site-lisp/

	cd "$pkgdir"/usr/share/emacs/site-lisp
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
1f3d2e64e96c1a750ea685ba03e31b920888e2ebcd3ae9c1859771f22de4e2e270768e96fe10d06fb76d6f55ece271063e7832ce3aade6c348b9ddd17a0154f5  emacs-liberime-cc9eb9812fd6f68e78ed6a0c0a85da7a18765753.tar.gz
"
